Repository navigation
feat: label MAC addresses that begin with 52 as Locally Admined MAC - #457
Open
TheWitness wants to merge 3 commits into
Open
TheWitness wants to merge 3 commits into
TheWitness wants to merge 3 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The fallback incorrectly labels full MAC addresses as locally administered even when a matching vendor row exists because the lookup uses eight characters instead of the six-character OUI key.
1 open issue
What changed in this PR
Adds a query-time Locally Admined MAC vendor label to Device Tracking’s MAC and IP address views for unnamed MAC addresses beginning with 52. Existing scan data is covered without a rescan or migration, with OUI names intended to take precedence.
Changes:
- Adds shared fallback helpers and uses the computed vendor name for display, sorting, export, and search.
- Adds unit and optional database tests for labelling, vendor precedence, and search.
- Updates the translation template and changelog.
| File | Description |
|---|---|
tests/Unit/LocallyAdministeredMacTest.php |
Tests label helpers, SQL generation, lookup fallback, and view integration. |
tests/Integration/LocallyAdministeredMacDatabaseTest.php |
Tests vendor precedence and label searches using temporary database tables. |
mactrack_view_macs.php |
Uses computed vendor names in MAC queries and searches. |
mactrack_view_arp.php |
Uses computed vendor names in IP queries and searches. |
locales/po/cacti.pot |
Adds the new vendor label to the translation template. |
lib/mactrack_functions.php |
Defines fallback helpers and updates vendor lookup behaviour. |
CHANGELOG.md |
Documents the new query-time vendor label. |
Review effort: Balanced
xmacan
previously approved these changes
Nov 17, 2026
…tabase test into the existing class Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
xmacan
previously approved these changes
Nov 17, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
A MAC address whose first octet is 52 is locally administered, so no vendor registers it and the OUI database cannot name it. The MAC Addresses and IP Addresses views now show Locally Admined MAC as the vendor for any address that begins with 52 and that the OUI database does not name.
52:54:00stays Virtual/KVM Host.How it works
The label is worked out when a view runs, not stored.
mactrack_vendor_name_sql()returnsCOALESCE(mtod.vendor_name, IF(SUBSTRING(mac, 1, 2) = '52', 'Locally Admined MAC', NULL)). The views select that expression asvendor_name, and their search filter uses the same expression, so the label is displayed, sorted, exported and searchable.I chose this over discovery-time labelling because:
A registered OUI row always wins over the label.
mactrack_get_vendor_name()(currently unused) applies the same fallback.Tests
MACTRACK_TEST_DSNis set, as it is in CI) runs the expression against real tables. It checks that 52:54:00 keeps its OUI name, other 52 addresses are labelled, other addresses are untouched, and searchingLocally Adminfinds them.The full suite passes against MariaDB (1128 tests).
locales/po/cacti.potis updated for the one new string.Note
The request was for addresses that begin with 52. The IEEE locally administered bit also covers first octets ending in 2, 6, A or E (for example
02,0A,DA). This PR leaves those unlabelled, as requested.